package controllers

import (
	"alert-dingtalk-hook/models"
	"fmt"
)

// DingDingController
type DingDingController struct {
	BaseController
}

// @Title Post
// @Success 200 "发送成功"
// @Failure 400 Param check failed
// @Failure 500 post DingDing common error
// @router / [Post]
func (c *DingDingController) Post() {
	data := c.Ctx.Input.RequestBody
	fmt.Println("data=%s", string(data))
	if err := models.SendDingtalk(string(data)); err == nil {
		fmt.Println("钉钉告警信息发送成功!")
	} else {
		fmt.Println("钉钉告警信息发送失败!")
	}
}